<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <div>
        <h1>用户管理中心</h1>
        <router-link to="/user/xiaoming">小明</router-link>
        <router-link to="/user/xiaohong?age=18&gender=female#a=b">小红</router-link>
    </div>
    <router-view></router-view>
</div>
<script src="../node_modules/vue/dist/vue.js"></script>
<script src="../node_modules/vue-router/dist/vue-router.js"></script>
<script>
    const User = {
        template: `<div>
            用户信息
            <p>姓名：{{$route.params.name}}</p>
            <p>年龄：{{$route.params.age}}</p>
            <p>性别：{{$route.params.gender}}</p>
            <p>hash值：{{$route.params.hash}}</p>
        </div>`
    };
    const router = new VueRouter({
        routes: [
            {path: '/user/:name', component: User}
        ]
    });
    let vm = new Vue({
        el: '#app',
        data: {},
        router: router
    })
</script>
</body>
</html>